<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Strict//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<title>在此插入标题</title>
</head>
<body>

<input type="button" value="QQ" onclick="redirect();">

  <script type="text/javascript">
	var loadIframe = null;
	function createIframe() {
		var iframe = document.createElement("iframe");
		iframe.style.cssText = "display:none;width:0px;height:0px;";
		document.body.appendChild(iframe);
		loadIframe = iframe;
	}
	function isWeiXin(){ 
		var ua = window.navigator.userAgent.toLowerCase(); 
		if(ua.match(/MicroMessenger/i) == 'micromessenger'){ 
		return true; 
		}else{ 
		return false; 
		} 
	} 
	function redirect() {
		if(isWeiXin()){
			window.location.href= "http://wpa.qq.com/msgrd?v=3&uin=1059011827&site=qq&menu=yes";
		}else{
			loadIframe.src = "http://wpa.qq.com/msgrd?v=3&uin=1059011827&site=qq&menu=yes";
		}
		
	}
	createIframe();
</script>
</body>
</html>